﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RakutenProxy.Model.Rakuten.Mapping
{
    public class ProductAttributeMapping:EntityTypeConfiguration<ProductAttribute>
    {
        public ProductAttributeMapping()
        {
            this.HasKey(t => t.ProductAttributeId);
            this.Property(t => t.Name).IsRequired();
            this.Property(t => t.IdentityName).IsRequired();

            this.HasMany(t => t.ProductAttributeValues).WithRequired(p => p.ProductAttribute).HasForeignKey(p => p.ProductAttributeId);
            this.HasMany(t => t.Product_ProductAttribute_Mappings).WithRequired(p => p.ProductAttribute).HasForeignKey(p => p.ProductAttributeId);
        }
    }
}
